import { createRouter, createWebHashHistory } from 'vue-router';

export default createRouter({
  history: createWebHashHistory(),
  routes: [
    {
    // 主页
      path: '/',
      name: '首页',
      component: () => import('@/views/home/index.vue'),
      children: [
        {
          path: '/',
          component: () => import('@/views/home/children/home.vue'),
        },
        {
          path: '/category/:id',
          name: 'category',
          component: () => import('@/views/home/children/category.vue'),
        },
        {
          path: '/category/sub/:id',
          name: 'subCategory',
          component: () => import('@/views/home/children/subcategory.vue'),
        },
        // 商品详情页
        {
          path: '/product/:id',
          name: 'detail',
          component: () => import('@/views/home/children/detail.vue'),
        },
      ],
    },
    {
    // 登录
      path: '/login',
      component: () => import('@/views/login/index.vue'),
    },
  ],
});
